package cn.kgc.spring.jdbc.service;

import cn.kgc.spring.jdbc.entity.Student;
import cn.kgc.spring.jdbc.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: mosin
 * @version: v1.0  2022/4/26
 */
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;


    @Override
    public Student selectOne(int id) {

        Student student = studentMapper.selectOne(id);
        return student;
    }

    @Override
    public List<Student> selectAll() {
        List<Student> students = studentMapper.selectAll();
        return students;
    }

    @Override
    public int selectTotal() {
         int  count =  studentMapper.selectTotal();
        return count;
    }

    @Override
    public int addStudent(Student student) {
        int line = studentMapper.addStudent(student);
        return line;
    }

    @Override
    public int updateStudent(Student student) {
        int i = studentMapper.updateStudent(student);
        return i;
    }

    @Override
    public int delStudent(int id) {
        int i = studentMapper.delStudent(id);
        return i;
    }
}
